package cn.com.open.opensaas.baiscommon.util;

/**
 * 字符串处理工具类
 *
 * @author lucky
 */
public class StringUtil {

    /**
     * Instantiates a new String util.
     */
    private StringUtil() {
    }

    /**
     * 验证字符串是否为空
     *
     * @param param the param
     * @return boolean boolean
     */
    public static boolean isEmpty(String param) {
        return param == null || param.trim().length() < 1;
    }

    /**
     * 格式化sql用in语句使用的含有单引号的字符串.
     *
     * @param originalString the original string
     * @return the string
     */
    public static String formatSqlInString(String originalString) {
        StringBuilder sbString = new StringBuilder();
        for (String arr : originalString.split(",")) {
            sbString.append(String.format("'%s',", arr));
        }
        String resultString = "";
        if (originalString.length() > 0) {
            resultString = sbString.toString().substring(0, sbString.length() - 1);
        }

        return resultString;
    }
}